package com.fruits.login.model;

import com.fruits.util.RegexProperties;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 获取短信验证码时的参数列表
 */
@Data
public class GetPhoneCode {

//    @Past(message = "时间戳必须是一个过去的时间点")
    @NotNull(message = "时间戳不能为空")
    private String timestamp;

    @NotNull(message = "电话号码不能为空")
    @Pattern(regexp = RegexProperties.REGEX_PHONE,message = "电话号码格式不正确")
    private String phone;

    private String sign;

    public GetPhoneCode(String timestamp, String phone, String sign) {
        this.timestamp = timestamp;
        this.phone = phone;
        this.sign = sign;
    }

    @Override
    public String toString() {
        return "GetPhoneCode{" + "timestamp='" + timestamp + '\'' + ", phone='" + phone + '\'' + ", sign='" + sign + '\'' + '}';
    }
}
